﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FJERP.BLL;
using FJERP.Model;

namespace FJERP.Handler
{
    /// <summary>
    /// Blitem 的摘要说明
    /// </summary>
    public class Blitem : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string action = context.Request["action"].ToString();
            System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(action);
            if (methodInfo != null)
            {
                methodInfo.Invoke(this, new object[] { context });
            }
        }
        public void GetStockById(HttpContext context)
        {
            BlitemBLL bll = new BlitemBLL();
            context.Response.Write(bll.GetStockById(int.Parse(context.Request["Stock_Id"].ToString())));
        }
        public void GetPandianType(HttpContext context)
        {
            BlitemBLL bll = new BlitemBLL();
            context.Response.Write(bll.GetPandianType());
        }
        public void BlitemAdd(HttpContext context)
        {
            BlitemBLL bll = new BlitemBLL();
            FJERP.Model.Blitem s = new Model.Blitem();
            s.Blitem_Etc = context.Request["Blitem_Etc"].ToString();
            s.WareHose_Id = Convert.ToInt32(context.Request["WareHose_Id"].ToString());
            s.Blitem_num = Convert.ToInt32(context.Request["Blitem_num"].ToString());
            s.Stock_Num = int.Parse(context.Request["Stock_Num"].ToString());
            s.Blitem_Stock_num = int.Parse(context.Request["Blitem_Stock_num"].ToString());
            s.Blitem_Rownum = int.Parse(context.Request["Blitem_Rownum"].ToString());
            s.Product_Id = Convert.ToInt32(context.Request["Product_Id"].ToString());
            s.Blitem_Type_Id = int.Parse(context.Request["Blitem_Type_Id"].ToString());
            s.Stock_Id = int.Parse(context.Request["Stock_Id"].ToString());
            context.Response.Write(bll.AddPandian(s));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}